package com.eastfair.certificate.enumeration;

import com.eastfair.annotation.base.BaseEnum;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * <p>
 * 实体注释中生成的类型枚举
 * 
 * </p>
 *
 * @author ligang
 * @date 2023-03-02
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "BlacklistKindEnum", description = "分类:#{POLICE:公安;VENUE:场馆;EXHIBITION:展会;-枚举")
public enum BlacklistKindEnum implements BaseEnum {

    /**
     * POLICE="公安"
     */
    POLICE("公安"),
    /**
     * VENUE="场馆"
     */
    VENUE("场馆"),
    /**
     * EXHIBITION="展会"
     */
    EXHIBITION("展会"),
    ;

    @ApiModelProperty(value = "描述")
    private String desc;


    /**
     * 根据当前枚举的name匹配
     */
    public static BlacklistKindEnum match(String val, BlacklistKindEnum def) {
        return Stream.of(values()).parallel().filter(item -> item.name().equalsIgnoreCase(val)).findAny().orElse(def);
    }

    public static BlacklistKindEnum get(String val) {
        return match(val, null);
    }

    public boolean eq(BlacklistKindEnum val) {
        return val != null && eq(val.name());
    }

    @Override
    @ApiModelProperty(value = "编码", allowableValues = "POLICE,VENUE,EXHIBITION", example = "POLICE")
    public String getCode() {
        return this.name();
    }

}
